package com.meterreadingsys.activity;




import java.io.File;
import java.util.HashMap;
import java.util.Map;

import com.meterreadingsys.db.DBOpenHelper;
import com.meterreadingsys.httpserver.HttpMultipartPost;


import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener{
    
	public Button button1;
	
	public Button button2;
	
	public Button button3;
	
	public Button button4;
	
	HttpMultipartPost http=null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button1=(Button)findViewById(R.id.button1);
        button1.setOnClickListener(this);
        button2=(Button)findViewById(R.id.button2);
        button2.setOnClickListener(this);
        button3=(Button)findViewById(R.id.button3);
        button3.setOnClickListener(this);
        button4=(Button)findViewById(R.id.button4);
        button4.setOnClickListener(this);
     
       
    }
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.button3:
			System.out.println("考勤");			
			Intent intent=new Intent(MainActivity.this, CheckWorkActivity.class);
			startActivity(intent);
			break;
		case R.id.button4:
			System.out.println("系统设置");
			Intent intent1=new Intent(MainActivity.this, SettingActivity.class);
			startActivity(intent1);
			break;
		case R.id.button1:
			File file=new File("/sdcard/DownFile/中abc文会乱111.zip");
			Map<String, String> map=new HashMap<String, String>();
			map.put("filename", file.getName());
			 http=new HttpMultipartPost(MainActivity.this,map,file);
			
			http.execute("http://192.168.0.9:8080/Struts2/execute");
			break;
		case R.id.button2:
			   Intent intent3=new Intent(MainActivity.this, UserManagerActivity.class);
			   startActivity(intent3);
			   break;
		default:
			break;
		}
		
	}
	

   
}
